package com.cms.web.pub;

import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;

import com.efounder.builder.base.data.EFDataSet;
import com.efounder.builder.base.data.EFRowSet;
import com.metadata.biz.MetaDataServiceMgr;

public class EMPUtil {

	public static EFRowSet getDictsMetaRowSet(MetaDataServiceMgr metaDataServiceMgr, Map dataMap) {
		EFRowSet              metaRowSet = EFRowSet.getInstance();
		Iterator             keyIterator = dataMap.entrySet().iterator();
		String                       key = "";
		String                 tableName = "";
		EFDataSet     itemObjColsDataSet = null;
		
		while(keyIterator.hasNext()) {
			Map.Entry m = (Entry) keyIterator.next();
			key = m.getKey().toString();
			if(!key.endsWith("_ITEM")) continue;
			tableName = key.substring(0, key.indexOf("_ITEM"));
			itemObjColsDataSet = metaDataServiceMgr.getSYS_OBJCOLS(tableName);
			if(itemObjColsDataSet.getRowCount() > 0) {
				metaRowSet.setDataSet(key, itemObjColsDataSet);
			}
		}
		return metaRowSet;
	}
}
